--- /dev/null
+# Makefile for tests code
+#
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+
+if BUILDOPT_INSTALL_TESTS
+insttestdir=$(pkglibexecdir)/installed-tests
+testfiles = t0000-basic \
+ t0001-archive \
+ t0002-archivez \
+ t0003-log \
+ t0004-remote-add \
+ t0005-corruption \
+ t0006-libarchive \
+ t0011-pull-archive-z \
+ $(NULL)
+insttest_SCRIPTS = $(addprefix tests/,$(testfiles:=.sh))
+
+insttest_DATA = tests/archive-test.sh \
+ tests/pull-test.sh \
+ tests/libtest.sh \
+ $(NULL)
+
+%.test: tests/%.sh Makefile
+ $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
+ echo 'Exec=$(pkglibexecdir)/installed-tests/$(notdir $<)' >> $@.tmp; \
+ echo 'Type=session' >> $@.tmp; \
+ echo 'Output=TAP' >> $@.tmp; \
+ mv $@.tmp $@)
+
+testmetadir = $(datadir)/installed-tests/$(PACKAGE)
+testmeta_DATA = $(testfiles:=.test)
+
+endif
include Makefile-ostree.am
include Makefile-switchroot.am
include Makefile-triggers.am
+include Makefile-tests.am
+
# Docbook generation copied from systemd/Makefile.am
#
enable_triggers_only=no)
AM_CONDITIONAL(TRIGGERS_ONLY, test x$enable_triggers_only != xno)
+AC_ARG_ENABLE(installed_tests,
+ AS_HELP_STRING([--enable-installed-tests],
+ [Install test programs (default: no)]),,
+ [enable_installed_tests=no])
+AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
+
AC_CHECK_HEADER([attr/xattr.h],,[AC_MSG_ERROR([You must have attr/xattr.h from libattr])])
PKG_PROG_PKG_CONFIG
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-cd `dirname $0`
-SRCDIR=`pwd`
-cd -
-TMPDIR=${TMPDIR:-/tmp}
-export TMPDIR
-test_tmpdir=`mktemp -d "$TMPDIR/ostree-tests.XXXXXXXXXX"`
-cd "$test_tmpdir"
-touch "$test_tmpdir/.test$$"
+SRCDIR=$(dirname $0)
+test_tmpdir=$(pwd)
export G_DEBUG=fatal-warnings
CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=full --num-callers=30 --suppressions=${SRCDIR}/ostree-valgrind.supp"
fi
-die () {
- if test -z "$OT_TESTS_DEBUG"; then
- test -f "$test_tmpdir/.test$$" && rm -rf "$test_tmpdir"
- else
- echo "Temporary files saved in $test_tmpdir"
- fi
-}
-
assert_streq () {
test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
}
}
setup_fake_remote_repo1() {
+ if ! test -x ${SRCDIR}/run-apache; then
+ exit 77
+ fi
mode=$1
shift
oldpwd=`pwd`
export OSTREE="ostree --repo=repo"
}
-
-trap 'die' EXIT
echo "1..30"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
echo "ok setup"
cd ${test_tmpdir}
$OSTREE checkout test2 --allow-noent --subpath /enoent 2>/dev/null
echo "ok subdir noent"
-
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..11'
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..11'
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo "1..1"
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..2'
echo "1..1"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
$OSTREE checkout test2 checkout-test2
echo "1..7"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
cd ${test_tmpdir}
set -e
-. libtest.sh
-
-echo '1..2'
+. $(dirname $0)/libtest.sh
setup_fake_remote_repo1 "archive-z2"
+echo '1..2'
+
. ${SRCDIR}/pull-test.sh